<?php

/**
 * Class DefaultController
 */
class DefaultController extends BController
{

	public function filters()
	{
		return array(
			array(
				'bootstrap.filters.BootstrapFilter',
			),
		);
	}

	public function actionIndex()
	{
		$model = new InstallForm();
		if (isset($_POST['InstallForm'])) {
			$model->setAttributes($_POST['InstallForm']);
			if ($model->install()) {
				Yii::app()->getUser()->setFlash('success', '安装成功。');
				$this->redirect(array('/site/login'));
			} else {
				Yii::app()->getUser()->setFlash('error', '安装失败。');
			}
		}
		$this->layout = '//layouts/site';
		$this->render('install', array('model' => $model));
	}
}
